package com.sinba.common.dto;

import java.util.List;


/**
 * This is a pagination DTO
 * @author sinba
 */
public class PageDTO extends AbstractValueObject {

    private static final int DEFAULT_ROW_NUM = 20;
    private int totalSize;
    private List data;
    private int page;
    private int total;
    private int rows = DEFAULT_ROW_NUM;

    public int getRows() {

        return rows;
    }

    public void setRows(int rows) {

        this.rows = rows;
    }

    public int getPage() {

        return page;
    }

    public void setPage(int page) {

        this.page = page;
    }

    public int getTotal() {

        total = totalSize / rows;

        if ((totalSize % rows) != 0) {

            total = total + 1;
        }

        return total;
    }

    public void setTotal(int total) {

        this.total = total;
    }

    public int getTotalSize() {

        return totalSize;
    }

    public void setTotalSize(int totalSize) {

        this.totalSize = totalSize;
    }

    public List getData() {

        return data;
    }

    public void setData(List data) {

        this.data = data;
    }
}